/**
 * Created by Administrator on 2016/6/22 0022.
 */
import React from 'react';
import Slider from 'react-slick';

var scope;
export default class ViewCarousel extends React.Component{

    constructor(props){
        super(props);
        scope = this;
    };

    render(){
        var array = scope.props.data;
        var settings = {
            autoplay: true,
            dots: true,
            lazyLoad: true,
            infinite: true,
            speed: 1000,
            slidesToShow: 1,
            slidesToScroll: 1,
            arrows : false,
        };

        var items = array.map(function (item) {
            return (
                <div>
                    <img src={item.img_url} alt="商品详情图片" />
                </div>
            );
        });

        return (
            <div className="carousel-box">
                <Slider {...settings}>
                    {items}
                </Slider>
            </div>
        );
    }
}